
Public Class ClaseEditorial

#Region " Campos y constantes privadas "
    Private campoID As Integer
    Private campoEditorial As String

    Private Const sql As String = "editorial_select"
    Private Const sqlRecuperar As String = " select nombreEditorial from editorial where id = @id"
    Private Const tabla As String = "editorial"
    Private Const displaymember As String = "nombreEditorial"
    Private Const valuemember As String = "id"
#End Region

#Region " RegionName "
    Public Property Id() As Integer
        Get
            Return campoID
        End Get
        Set(ByVal value As Integer)
            campoID = value
        End Set

    End Property

    Public Property Editorial() As String
        Get
            Return campoEditorial
        End Get
        Set(ByVal value As String)
            campoEditorial = value
        End Set
    End Property
#End Region

    Public Sub Grabar()
        Dim grabador As New ClaseGestorGenerico
        grabador.Grabar(campoEditorial, tabla, displaymember)
    End Sub

    Public Function RecuperarTodos() As DataTable
        Dim recuperar As New ClaseGestorGenerico
        Return recuperar.RecuperarTodos(sql)
    End Function
    Shared Sub LlenarCombo(ByRef combo As ComboBox)
        Dim recuperar As New ClaseGestorGenerico
        Dim dataTable As DataTable
        dataTable = recuperar.RecuperarTodos(sql)
        recuperar.LlenarCombo(combo, displaymember, valuemember, dataTable)
    End Sub
    Shared Sub LlenarListBox(ByRef list As ListBox)
        Dim recuperar As New ClaseGestorGenerico
        Dim dataTable As DataTable
        dataTable = recuperar.RecuperarTodos(sql)
        recuperar.LlenarListBox(list, displaymember, valuemember, dataTable)
    End Sub
    Public Sub recuperarNombre()
        Dim recuperar As New ClaseGestorGenerico
        campoEditorial = recuperar.recuperarNombre(campoID, sqlRecuperar, tabla)
    End Sub
End Class
